<?php
/**
 * @version		$Id: bannerclient.php 16825 2010-05-05 12:10:37Z louis $
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_BASE') or die;

jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');

/**
 * Bannerclient Field class for the Joomla Framework.
 *
 * @package		Joomla.Framework
 * @subpackage	com_banners
 * @since		1.6
 */
class JFormFieldFilesList extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since	1.6
	 */
	protected $type = 'FilesList';

	/**
	 * Method to get the field options.
	 *
	 * @return	array	The field option objects.
	 * @since	1.6
	 */
	public function getOptions()
	{
		// Initialize variables.
		$options = array();
		$options2 = array();
		
		$_dir			= ( isset($this->element['directory']) ) ? $this->element['directory'] : '';
		
		// Read the languages dir to find languages
		$BaseDir 	= JPATH_SITE . $_dir;
		$options	= JFolder::files($BaseDir);
		
		foreach($options AS $option) {
			$opt 		= str_replace(".js", "", $option);
			$options2[] = JHtml::_('select.option', $opt, ucfirst($opt));
		}

		return $options2;
	}
}
